package com.luyu.tenant;

import com.alibaba.ttl.TransmittableThreadLocal;
import org.springframework.stereotype.Component;

@Component
public class TenantContextHolder {
  private static  final TransmittableThreadLocal<Long> tenantIdContext=new TransmittableThreadLocal<>();

  public static void setTenantId(Long tenantId){
    tenantIdContext.set(tenantId);
  }

  public static  Long getTenantId(){
    return tenantIdContext.get();
  }

  public static void remove(){
    tenantIdContext.remove();
  }

}
